package com.thundersoft.sdk;

public class FaceRecognizer
{

	public long impl = 0;	// native object pointer

	private native void construct(String model);
//	private native void construct(String model, String device);
	public native void dispose();

//    public FaceRecognizer() {
//        this("");
//    }

	public FaceRecognizer(String model) {
		this.construct(model);
	}

//	public FaceRecognizer(String model, String device) {
//		this.construct(model, device);
//	}

	protected void finalize() throws Throwable {
        super.finalize();
		this.dispose();
    }

//    public native boolean LoadModel(String model);
//
//    public native boolean LoadModel(String model, String device);

    public native int GetFeatureSize();

//    public native int GetCropWidth();
//
//    public native int GetCropHeight();
//
//    public native int GetCropChannels();

//    public boolean CropFace(ImageData image, Point[] landmarks, ImageData face) {
//        return CropFace(image, landmarks, face, 1);
//    }
//
//    public native boolean CropFace(ImageData image, Point[] landmarks, ImageData face, int pos_num);
//
//    public native boolean ExtractFeature(ImageData face, float[] feats);
//
//    public native boolean ExtractFeatureNormalized(ImageData face, float[] feats);

    public boolean ExtractFeatureWithCrop(ImageData image, Point[] landmarks, float[] feats) {
        return ExtractFeatureWithCrop(image, landmarks, feats, 1);
    }

    public native boolean ExtractFeatureWithCrop(ImageData image, Point[] landmarks, float[] feats, int pos_num);

//    public boolean ExtractFeatureWithCropNormalized(ImageData image, Point[] landmarks, float[] feats) {
//        return ExtractFeatureWithCropNormalized(image, landmarks, feats, 1);
//    }

//    public native boolean ExtractFeatureWithCropNormalized(ImageData image, Point[] landmarks, float[] feats, int pos_num);

    public float CalcSimilarity(float[] fc1, float[] fc2) {
        return CalcSimilarity(fc1, fc2, -1);
    }

    public native float CalcSimilarity(float[] fc1, float[] fc2, long dim);

//    public float CalcSimilarityNormalized(float[] fc1, float[] fc2) {
//        return CalcSimilarityNormalized(fc1, fc2, -1);
//    }

//    public native float CalcSimilarityNormalized(float[] fc1, float[] fc2, long dim);
}
